package com.study.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * ModelTest1 class
 *
 * @author chenyeqing
 * @date 2021/3/22
 */
@Controller
public class ModelTest1 {

    /**
     * 转发
     * @param model
     * @return
     */
    @RequestMapping("/m1/t1")
    public String test1(Model model) {
        model.addAttribute("msg", "qwe");
        return "/WEB-INF/jsp/test.jsp";
    }

    /**
     * 转发
     * @param model
     * @return
     */
    @RequestMapping("/m1/t2")
    public String test2(Model model) {
        model.addAttribute("msg", "qwe");
        return "forward:/WEB-INF/jsp/test.jsp";
    }

    /**
     * 重定向
     * @param model
     * @return
     */
    @RequestMapping("/m1/t3")
    public String test3(Model model) {
        model.addAttribute("msg", "qwe");
        return "redirect:/index.jsp";
    }

}
